package com.marvels.financial.consum.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.dubbo.externalservice.service.IntBankDataService;
import com.marvels.dubbo.externalservice.service.MailSendingService;
import com.marvels.dubbo.externalservice.service.PushFaceseSigService;
import com.marvels.financial.consum.FinancialConsumerExternalApi;
import com.marvels.financial.funds.dto.KimGeXinSignDTO;
import com.marvels.financial.loan.dto.MailInfoDTO;


@Component
public class FinancialConsumerExternalImpl implements FinancialConsumerExternalApi{

	@Autowired
	private PushFaceseSigService pushFaceSigService;
	
	@Autowired
	private IntBankDataService intBankDataService;
	
	
	@Autowired
	private MailSendingService mailSendingService;
	
	@Override
	public List<Map<String, Object>> detailsOfLoanInformation(Map<String, String> map) {
		try {
			List<Map<String, Object>> result = intBankDataService.detailsOfLoanInformation(map);
			MarvelsLogUtil.getInstance().info("FinancialConsumerExternalApi.detailsOfLoanInformation direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("FinancialConsumerExternalApi.detailsOfLoanInformation error", e);
			return null;
		}
	}





	@Override
	public void insertBatchMailSingle(List<MailInfoDTO> list) {
		try {
			/*List<com.fintech.mail.entity.MailInfo> param = com.alibaba.fastjson.JSONObject.parseArray(
					com.alibaba.fastjson.JSONObject.toJSONString(list), com.fintech.mail.entity.MailInfo.class);
			mailSendingService.insertBatchMailSingle(param);*/
			MarvelsLogUtil.getInstance().info("FinancialConsumerExternalApi.insertBatchMailSingle direct call success!");
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("FinancialConsumerExternalApi.insertBatchMailSingle error", e);
		}
	}

	@Override
	public KimGeXinSignDTO contractInitiationByPdf(KimGeXinSignDTO signDTO) {
		try {
			/*com.marvels.dubbo.externalservice.dto.KimGeXinSignDTO param = new  com.marvels.dubbo.externalservice.dto.KimGeXinSignDTO();
			BeanUtil.copyProperties(signDTO, param);
			com.marvels.dubbo.externalservice.dto.KimGeXinSignDTO apiResult = KimGeSignService.contractInitiationByPdf(param);*/
			KimGeXinSignDTO result = null;//com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(apiResult), KimGeXinSignDTO.class);
			MarvelsLogUtil.getInstance().info("FinancialConsumerExternalApi.contractInitiationByPdf direct call success!");
			return result;
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("FinancialConsumerExternalApi.contractInitiationByPdf error", e);
			return null;
		}
	}


	@Override
	public void sendMailSingle(MailInfoDTO list) {
		try {
			/*List<com.fintech.mail.entity.MailInfo> param = com.alibaba.fastjson.JSONObject.parseArray(
					com.alibaba.fastjson.JSONObject.toJSONString(list), com.fintech.mail.entity.MailInfo.class);
			mailSendingService.insertBatchMailSingle(param);*/
			MarvelsLogUtil.getInstance().info("FinancialConsumerExternalApi.sendMailSingle direct call success!");
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("FinancialConsumerExternalApi.sendMailSingle error", e);
		}
	}


	@Override
	public void pushFacePush(Map<String, String> map) {
		try {
			pushFaceSigService.pushFacePush(map);
			MarvelsLogUtil.getInstance().info("FinancialConsumerExternalApi.pushFacePush direct call success!");
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("FinancialConsumerExternalApi.pushFacePush error", e);
		}
	}
	
}
